﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using t01crm.Data;
using t01crm.Business;

namespace t01crm.View
{
    /// <summary>
    /// 
    /// </summary>
    public  class DesignTimeViewModel
    {
        protected static ListingCollection _searchResults;


        public  FilterMetadata FilterMetadata
        {
            get
            {
                return FilterMetadata.Current; 
            }
        } 

        public static ListingCollection SearchResults
        {
            get
            {
                if (_searchResults == null)
                {
                    _searchResults = new ListingCollection();

                    for (int x = 0; x < 10; x++)
                    {
                        _searchResults.Add(new Listing
                        {
                            //Address = new Address { City = "Bellevue", Address1 = "One Microsoft Way", State = "WA", ZipCode = "98052" },
                            //BathroomCount = 2.5,
                            //BedroomCount = 4,
                            //MLS = "abcd",
                            //SquareFootage = 2000,
                            //Description = "Description",
                            //Year = 1984, ClientRating = 4, Price = 150000.0 

                        });
                    } 
                 }
                return _searchResults;
            }
        }

        DataGridColumnsView _dataGridColumnsView = new DataGridColumnsView(); 
        public DataGridColumnsView DataGridColumnsView 
        {
            get
            {
                return _dataGridColumnsView; 
            } 
        }

         
    }


    public class DataGridColumnsView : BusinessEntity
    {
        private bool _showTitle = true; 
        public bool ShowTitle
        {
            get
            {
                return _showTitle; 
            }
            set
            {
                if (_showTitle != value)
                {
                    _showTitle = value;
                    OnPropertyChanged("ShowTitle"); 
                } 
            }
        }

        private bool _showPrice = true;
        public bool ShowPrice
        {
            get
            {
                return _showPrice;
            }
            set
            {
                if (_showPrice != value)
                {
                    _showPrice = value;
                    OnPropertyChanged("ShowPrice");
                }
            }
        }

        private bool _showBedrooms = true;
        public bool ShowBedrooms
        {
            get
            {
                return _showBedrooms;
            }
            set
            {
                if (_showBedrooms != value)
                {
                    _showBedrooms = value;
                    OnPropertyChanged("ShowBedrooms");
                }
            }
        } 
    } 

    public class MainViewModel : BusinessEntity 
    {

        // public SearchFilter Filter;

        ListingCollection _searchResults; 
        public ListingCollection SearchResults
        {
            get
            {
                if (_searchResults == null)
                {
                    _searchResults = new ListingCollection();
                    _searchResults.Add( new Listing());
                    _searchResults.Add(new Listing());
                    _searchResults.Add(new Listing()); 


                    
                } 
                return _searchResults; 
            }
            set
            {
                if (_searchResults != value)
                {
                    _searchResults = value;
                    OnPropertyChanged("SearchResults"); 
                } 
            } 
        }

        DataGridColumnsView _dataGridColumnsView = new DataGridColumnsView();
        public DataGridColumnsView DataGridColumnsView
        {
            get
            {
                return _dataGridColumnsView;
            }
        }

        //private Profile _currentProfile; 
        //public Profile CurrentProfile
        //{
        //    get
        //    {
        //        if (_currentProfile == null)
        //            _currentProfile = new Profile(); 
        //        return _currentProfile; 
        //    }
        //    set
        //    {
        //        if (_currentProfile != value)
        //        {
        //            _currentProfile = value;
        //            OnPropertyChanged("CurrentProfile"); 
        //        } 
        //    }
        //}

        public FilterMetadata FilterMetadata
        {
            get
            {
                return FilterMetadata.Current;
            }
        }

        public MostRecentFiles MostRecentFiles
        {
            get
            {
                return MostRecentFiles.SingletonNotImplemented;     
            } 

        } 
    }
}
